<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<title>Insert title here</title>
</head>
<body>
-----注册页面-------<br>
<form method="post" if="fm" action="Register_Servlet">
 昵称：<input type="text" name="webName"  id="webName"  onblur="webNameSearch()"/><span id="webNameSpan"></span><br>
 真实姓名：<input type="text" name="trueName" id="trueName"  /><br>
 密码：<input type="text" name="pwd" id="pwd" /><br>
 性别：<input type="radio" name="gender"  value="male"/>男<input type="radio" name="gender" value="female"/>女<br>
 出生日期：<br>
 身份证：<input type="text" name="IdNumber" id="IdNumber"/><br>
 邮箱：<input type="text" name="Email" id="Emali" /><br>
 手机号码：<input type="text" name="CellPhone" id="CellPhone" /><br>
  <input type="button" value="注册" id="register_submit" /><br>
</form>

<script type="text/javascript">
  function webNameSearch(){
      var name=$("#webName").val();
      //非空验证
      $("#webNameSpan").empty();
	  if(name==""){
		  $("#webNameSpan").append("昵称不能为空");
	  }
      //ajax局部刷新验证昵称是否存在
      $.ajax({
    	  url:'register_Servlet',  //请求地址
    	  type:'post', //请求类型
    	  data:{name:name},  //传递参数
    	  dataType:'text',  //预期的数据返回类型
    	  success:function(result){
    		    console.log(result);
    			console.log(typeof(result));
    			//json数据格式的解析
    			/* console.log("id="+result.id);
    			console.log("name="+result.name); */
    			
    			//json数组的解析
    	/* 		$.each(result,function(inx,ele){
    				console.log("id="+ele.id+" name="+ele.name);
    			}) */
    			
    			//对emp对象解析
    			//console.log("员工编号="+result.empno+" 员工姓名="+result.ename);
    			
    			
    		}
    	  
      })
	  
	  
  }
</script>




</body>
</html>